import { createApp } from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
// 路由配置
import router from '@/router/index'
// 状态管理工具 Pinia
import { createPinia } from 'pinia'
import persistedstate from 'pinia-plugin-persistedstate'
// 引入地球引擎
import { ESObjectsManager } from 'earthsdk3'
import { ESUeViewer } from 'earthsdk3-ue';
import { ESOlViewer } from 'earthsdk3-ol';
import { ESCesiumViewer } from 'earthsdk3-cesium';

const objm = new ESObjectsManager(ESUeViewer, ESCesiumViewer, ESOlViewer);
// const objm = new ESObjectsManager( ESCesiumViewer);
//@ts-ignore
window.g_objm = objm;

// -----------------
const app = createApp(App, { objm })
app.config.globalProperties.$objm = objm;
// 创建 pinia 实例
const pinia = createPinia()

// 挂载路由配置
app.use(router)
// 使用持久化存储插件
pinia.use(persistedstate)
app.use(pinia)

app.use(ElementPlus, { zIndex: 1, locale: zhCn })
// app.use(ElementPlus)
app.mount('#app')

//czm和ue的图层
objm.sceneTree.createSceneObjectTreeItemFromJson({
    "id": "ae103185-08c7-4ed0-b6d4-15ad77bbbf66",
    "type": "ESImageryLayer",
    "url": "https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",
    "maximumLevel": 18,
    "name": "全球影像",
    "allowPicking": true
})

// //openlayers的图层
// objm.sceneTree.createSceneObjectTreeItemFromJson({
//     "id": "ae103185-08c7-4ed0-b6d4-15ad77bbbf45",
//     "type": "ESXYZLayer",
//     "url": "http://t4.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=abd187e1140259634e44eea628b65e00"
// })
